module(..., package.seeall)

import("glutton.utils.named", "Named")

----------------------------------------------------------------------------------------------------
Bonus = class("Bonus", Named)

function Bonus.__init(self, value)
    self.value = value
end

function Bonus.apply_to(self, stat)
    notimplemented()
end

function Bonus.remove_from(self, stat)
    notimplemented()
end

----------------------------------------------------------------------------------------------------
--[[ Additive bonuses add an absolute value to a stat. ]]
AdditiveBonus = class("Bonus<+>", Bonus)

function AdditiveBonus.apply(self, stat)
    stat:add_bonus(self, stat.value + self.value)
end

----------------------------------------------------------------------------------------------------
--[[ Multiplicative bonuses add to a stat a value that is proportional to the stat's base value. ]]
MultiplicativeBonus = class("Bonus<*>", Bonus)

function MultiplicativeBonus.apply(self, stat)
    stat:add_bonus(self, stat.value + stat.base * self.value)
end

